

package com.hazelcast.internal.serialization.impl.portable;

import com.hazelcast.core.ManagedContext;
import com.hazelcast.internal.serialization.Data;
import com.hazelcast.nio.serialization.ClassDefinition;
import com.hazelcast.nio.serialization.FieldDefinition;
import com.hazelcast.nio.serialization.Portable;
import com.hazelcast.nio.serialization.PortableId;

import java.io.IOException;
import java.nio.ByteOrder;

public interface PortableContext {

    int getVersion();

    int getClassVersion(int factoryId, int classId);

    void setClassVersion(int factoryId, int classId, int version);

    ClassDefinition lookupClassDefinition(int factoryId, int classId, int version);

    ClassDefinition lookupClassDefinition(PortableId portableId);

    ClassDefinition lookupClassDefinition(Data data) throws IOException;

    ClassDefinition registerClassDefinition(ClassDefinition cd);

    ClassDefinition registerClassDefinition(ClassDefinition cd, boolean throwOnIncompatibleClassDefinitions);

    ClassDefinition lookupOrRegisterClassDefinition(Portable portable) throws IOException;

    FieldDefinition getFieldDefinition(ClassDefinition cd, String name);

    ManagedContext getManagedContext();

    ByteOrder getByteOrder();
}
